package chai.ningning.address;

import java.net.InetAddress;
import java.net.InetSocketAddress;

public class SocketAddressTest2 {

    public static void main(String[] args) {

        int port = 5555;
        InetSocketAddress isa = new InetSocketAddress(port);
        System.out.println(isa);

        String hostname = "DESKTOP-QUF3J7K";
        isa = new InetSocketAddress(hostname,port);
        System.out.println(isa);

        InetAddress inetAddress = isa.getAddress();
        System.out.println(inetAddress);

        System.out.println("---------------------------------------");
        System.out.println(isa.getPort());
        System.out.println(isa.getAddress());
        System.out.println(isa.getHostName());
        System.out.println(isa.getClass());
    }
}
